<template>
  <div class="wrapper" ref="wrapper" :style="{ height: height + 'px' }">
    <div>
      <template v-for="(item, index) in addorder">
        <myOrder :addorders="item" />
      </template>
    </div>
  </div>
</template>

<script>
import myOrder from "../../components/myOrder";
import BScroll from "better-scroll";
export default {
  data() {
    return {
      addorder: [],
      height: 500,
    };
  },
  components: {
    myOrder,
  },
  async mounted() {
    let data = await this.$api.getMenus({});
    this.addorder = data;
    let h = document.documentElement.clientHeight - 220;
    this.height = h;

    this.$nextTick(() => {
      let bs = new BScroll(this.$refs["wrapper"], {
        click: true,
        tap: "tap",
        probeType: 1,
        pullUpLoad: true,
        pullDownRefresh: true,
      });
      //下拉事件
      bs.on("pullingDown", () => {
        console.log("下拉时间");
        bs.finishPullDown();
      });
      bs.on("pullingUp", () => {
        console.log("到底了亲");
        bs.finishPullUp();
      });
    });
  },
};
</script>

<style lang="scss" scoped>
.wrapper {
  height: 400px;
  width: 100%;
  overflow: hidden;
}
</style>